//package com.tc.pay.controller.config.wx;
//
//import com.github.binarywang.wxpay.config.WxPayConfig;
//import com.github.binarywang.wxpay.service.WxPayService;
//import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
//import com.tc.pay.commom.core.utils.WeixinConfigUtil;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * 微信配置文件的初始化
//   这是boot的做法。
// * @author majie
// *
// */
//@Configuration
//@ConditionalOnClass(WxPayService.class)
//public class WxPayConfiguration {
//
//    @Bean
//    @ConditionalOnMissingBean
//    public WxPayConfig config() {
//        WxPayConfig payConfig = new WxPayConfig();
//        payConfig.setAppId(WeixinConfigUtil.readConfig("appId"));
//        payConfig.setMchId(WeixinConfigUtil.readConfig("mchId"));
//        payConfig.setMchKey(WeixinConfigUtil.readConfig("mchKey"));
//        payConfig.setSubAppId(WeixinConfigUtil.readConfig("subAppId"));
//        payConfig.setSubMchId(WeixinConfigUtil.readConfig("subMchId"));
//        payConfig.setKeyPath(WeixinConfigUtil.readConfig("keyPath"));
//        payConfig.setNotifyUrl(WeixinConfigUtil.readConfig("notify_url"));
//        return payConfig;
//    }
//
//    @Bean
//    //@ConditionalOnMissingBean
//    public WxPayService wxPayService(WxPayConfig payConfig) {
//        WxPayService wxPayService = new WxPayServiceImpl();
//        wxPayService.setConfig(payConfig);
//        return wxPayService;
//    }
//
//}
